package com.guoq.interceptors;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.log4j.Logger;
import org.springframework.web.servlet.HandlerInterceptor;
import org.springframework.web.servlet.ModelAndView;

import com.guoq.constant.SessionDatas;
import com.guoq.utils.PropertiesLoader;


/**
 * 
 * <P>类名称:GlobalInterceptors
 * <P>类描述:全局拦截器  
 * <P>创建人:张树林  
 * <P>修改人:XXX 
 * <P>修改时间:2017年2月22日 下午12:56:44
 * <P>修改备注: 
 * @version 1.0.0
 * Copyright(c)2017西部在线-版权所有
 */
public class GlobalInterceptors implements HandlerInterceptor{

	private Logger log = Logger.getLogger(this.getClass());
	
	@Override
	public boolean preHandle(HttpServletRequest request, HttpServletResponse response,
			Object handler) throws Exception {
		@SuppressWarnings("unchecked")
		Map<String, Object> user =(Map<String, Object>) request.getSession().getAttribute(SessionDatas.USER);
		request.setAttribute("user", user);
		request.setAttribute("reurl", PropertiesLoader.getPropertiesVal("result"));
		request.setAttribute("conmayname", "西部在线综合业务");
		return true;
	}

	@Override
	public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler,
			ModelAndView modelAndView) throws Exception {
	}

	@Override
	public void afterCompletion(HttpServletRequest request, HttpServletResponse response,
			Object handler, Exception ex) throws Exception {
	}

}
